/**
 * File: MetaData.java
 * Created by: mhaimel
 * Created on: Apr 19, 2010
 * CVS:  $Id: MetaData.java 1.0 Apr 19, 2010 2:40:28 PM mhaimel Exp $
 */
package uk.ac.ebi.curtain.utils.data;

/**
 * @author mhaimel
 *
 */
public class MetaData {
	
	private final FileType ftype;
	private final ReadType rtype;
	private final Integer category;
	
	public MetaData(Integer category, FileType fType, ReadType rType) {
		this.category = category;
		this.ftype = fType;
		this.rtype = rType;
	}
	
	public FileType getFileType() {
		return ftype;
	}

	public ReadType getReadType() {
		return rtype;
	}

	public Integer getCategory() {
		return this.category;
	}
	
	@Override
	public String toString() {
		return new StringBuilder()
			.append(getCategory())
			.append("; ")
			.append(getFileType())
			.append(",")
			.append(getReadType())
			.toString();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((category == null) ? 0 : category.hashCode());
		result = prime * result + ((ftype == null) ? 0 : ftype.hashCode());
		result = prime * result + ((rtype == null) ? 0 : rtype.hashCode());
		return result;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		MetaData other = (MetaData) obj;
		if (category == null) {
			if (other.category != null)
				return false;
		} else if (!category.equals(other.category))
			return false;
		if (ftype == null) {
			if (other.ftype != null)
				return false;
		} else if (!ftype.equals(other.ftype))
			return false;
		if (rtype == null) {
			if (other.rtype != null)
				return false;
		} else if (!rtype.equals(other.rtype))
			return false;
		return true;
	}	
}
